home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
makemenu.zip
/
MAKEMENU.BAT
< prev
next >
Wrap
DOS Batch File
|
1989-05-09
|
5KB
|
189 lines
echo off
if '%1' == '??' put ??
if '%1' == '??' goto die
if '%1' == '' goto help
if '%1' == '?' goto help
if '%1' == 'makemenu' goto help
if '%1' == 'MAKEMENU' goto help
if not '%2' == '' goto help
: test validity of menu-name
echo erase me>%1.$mm
if not exist %1.$mm goto help
del %1.$mm
:--------------------------------------------------------------------------
cls
echo M A K E A M E N U : %1
if not exist %1.bat goto getbrief
echo
echo Replace existing %1.bat? (Press Y for yes, N to exit)
pick y n Esc
if errorlevel 2 echo no
if errorlevel 2 goto exit
if not errorlevel 1 goto exit
echo yes
del %1.bat
cls
echo M A K E A M E N U : %1
:
:getbrief
:
echo
echo Enter descriptive name for menu (for example "Main Menu"):
get @se.*@!\26\60\62\124\192 1 45 >menudesc.$mm
if errorlevel 5 goto badwrit
if errorlevel 4 goto exit
echo echo off >menu.$mm
echo :start >>menu.$mm
echo cls >>menu.$mm
:
:asktext
:
echo
if not exist %1.mnu goto gettext
cls
echo M A K E A M E N U : %1
echo
type %1.mnu
echo
echo
echo
echo Is the text you want shown above? (Press Y for yes, N to enter new text)
pick y n Esc
if errorlevel 3 goto exit
if errorlevel 2 echo no
if errorlevel 2 goto gettext
if not errorlevel 1 goto exit
echo yes
goto gottext
:
:gettext
:
cls
echo M A K E A M E N U : %1
echo
echo Enter text for menu. Press F6 when done:
get @se.r@!\26\60\62\124\192 >%1.mnu
if errorlevel 5 goto badwrit
if errorlevel 4 goto exit
goto asktext
:
:gottext
:
: make a box around the menu text
:
makebox c <%1.mnu >menutext.box
makebox c* :echo <%1.mnu >>menu.$mm
if errorlevel 1 goto badwrit
:
: initialize files
:
type nul >options.$mm
type nul >cmdline.$mm
type nul >goto.$mm
type nul >exit.$mm
echo 0 >count.$mm
echox 1. pick >pick.$mm
if errorlevel 1 goto badwrit
:
:getopt
:
cls
type menutext.box
echo
echo Options specified:
type options.$mm
echo
echo
echo Press key for option to specify, or else type Ctrl-C if done.
get @re.n!co@\27\13\10!.\ 1 1 >key$.$mm
if errorlevel 5 goto badwrit
if errorlevel 4 goto assemble
define <key$.$mm \13=RET \10=RET \32=SP ╗=F1 ╝=F2 ╜=F3 ╛=F4 ┐=F5 └=F6 ┴=F7 ┬=F8 ├=F9 ─=F10 =Esc >option.$mm
type option.$mm
x echo :{option.$mm}-PICK >>cmdline.$mm
echo cls >>cmdline.$mm
: put a blank between options
echo a b | xtrchars 2 1 >>options.$mm
type option.$mm >>options.$mm
echo 1 >count$.$mm
type count.$mm >>count$.$mm
sum <count$.$mm >count.$mm
x echo if errorlevel {count.$mm} goto {option.$mm}-PICK >>goto.$mm
echo
echo
echo Enter command line(s) to execute for the option. Press F6 when done.
get @sre@!\192 >>cmdline.$mm
if errorlevel 5 goto badwrit
if errorlevel 4 goto exit
echo echo >>cmdline.$mm
x echo echo Strike any key to return to {menudesc.$mm} . . . >>cmdline.$mm
echo pause \62nul >cmdline$.$mm
decode <cmdline$.$mm >>cmdline.$mm
echo goto start >>cmdline.$mm
echo
echo
echo Do you want to specify more options? (Press y for yes, n for no)
pick n y Esc
if errorlevel 3 goto exit
if errorlevel 2 echo yes
if errorlevel 2 goto getopt
if errorlevel 1 echo no
if errorlevel 1 goto assemble
goto exit
:
:assemble
:
type goto.$mm >goto$.$mm
backward 1 <goto$.$mm >goto.$mm
if errorlevel 1 goto badwrit
echo goto exit >>goto.$mm
echo :exit >exit.$mm
echo put 23 1 >>exit.$mm
type options.$mm >options$.$mm
ensure <options$.$mm >options.$mm
if errorlevel 2 goto badwrit
copy menu.$mm + pick.$mm + options.$mm + goto.$mm + cmdline.$mm + exit.$mm menu.$mm >nul
move menu.$mm %1.bat >nul
del *.$mm
del menutext.box
%1
: we will not return to this batch file; but just in case...
goto exit
:--------------------------------------------------------------------------
:
:help
:
put -2 2x79
echo EasyTools Utilities version 1.0 Copyright by EasyTools 1989 All Rights Reserved
echo MAKEMENU requires: PUT, GET, PICK, MAKEBOX, ECHOX, DEFINE, SUM, DECODE,
echo BACKWARD, ENSURE, MOVE, X, XTRCHARS.
echo
echo Usage: MAKEMENU menu-name
echo
echo For example, MAKEMENU MAIN
echo
echo Creates batch file(s) that function as (multi-level) menu system.
echo
echo Menu text (menu-name.MNU) can be created or modified by text-editor for
echo easier manipulation if desired.
echo
echo Note that registered users may distribute their menu systems, including
echo any required EasyTool programs, without royalty.
echo
echo For complete instructions, see User Guide (type "MAKEMENU ??")
goto die
:
:badwrit
:
echo MAKEMENU: Cannot write to disk. Insufficient disk space?
:
:exit
:
echo a >x.$mm
del *.$mm
if exist menutext.box del menutext.box
:
:die
:
echo